package com.ch3cooh.server1.controller;

import com.ch3cooh.server1.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @Autowired
    HelloService helloService;

    @RequestMapping("/lockDo")
    public String testLock(){
        boolean res = helloService.getLockAndSleep(10000);
        return res?"server1获得了锁并完成了任务":"server1获取锁失败";
    }

}
